<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 20/05/24
  Time: 23:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h1>用户列表</h1>

    <!--a标签默认行为href 即get请求-->
<%--    <a href="delete/1" onclick="deleteById()">删除</a>--%>
    <a href="javascript:void(0)" onclick="deleteById()">删除</a>
    <a href="javascript:void(0)" onclick="updateById()">修改</a>

    <!--Spring 框架要求的固定写法，必须有个隐藏form，配置_method-->
    <form style="display: none" action="delete/1" method="post" id="form1">
        <input type="text" name="_method" value="DELETE"/>
<%--        <button>提交</button>--%>
    </form>
    <form style="display: none" action="update/1" method="post" id="form2">
        <input type="text" name="_method" value="PUT"/>
    </form>
</body>

<script>
    function deleteById() {
        document.getElementById("form1").submit();
    }
    function updateById() {
        document.getElementById("form2").submit();
    }
</script>
</html>
